<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--
 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
 * Copyright (C) 2003-2007 Frederico Caldeira Knabben
 *
 * == BEGIN LICENSE ==
 *
 * Licensed under the terms of any of the following licenses at your
 * choice:
 *
 *  - GNU General Public License Version 2 or later (the "GPL")
 *    http://www.gnu.org/licenses/gpl.html
 *
 *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
 *    http://www.gnu.org/licenses/lgpl.html
 *
 *  - Mozilla Public License Version 1.1 or later (the "MPL")
 *    http://www.mozilla.org/MPL/MPL-1.1.html
 *
 * == END LICENSE ==
 *
 * Link dialog window.
-->
<html>
<head>
	<title>Image Properties</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="robots" content="noindex, nofollow" />
	<script type="text/javascript">

var oEditor		= window.parent.InnerDialogLoaded() ;
var FCK			= oEditor.FCK ;
var FCKLang		= oEditor.FCKLang ;
var FCKConfig	= oEditor.FCKConfig ;
var FCKRegexLib	= oEditor.FCKRegexLib ;
var FCKTools	= oEditor.FCKTools ;

document.write( '<script src="' + FCKConfig.BasePath + 'dialog/common/fck_dialog_common.js" type="text/javascript"><\/script>' ) ;

	</script>
	<script type="text/javascript">

// Get the selected flash embed (if available).
var oFakeImage = FCK.Selection.GetSelectedElement() ;
var oImgAssistNode ;

if ( oFakeImage )
{
	if ( oFakeImage.tagName == 'IMG' && GetAttribute(oFakeImage, '_fckimgassist', false) )
	if ( GetAttribute(oFakeImage, 'nid', false) ) oImgAssistNode = oFakeImage ;
	else
		oFakeImage = null ;
}

window.onload = function()
{
	// Translate the dialog box texts.
	oEditor.FCKLanguageManager.TranslatePage(document) ;

	// Load the selected link information (if any).
	LoadSelection() ;

	// Activate the "OK" button.
	window.parent.SetOkButton( true ) ;
	window.parent.SetAutoSize( true ) ;
}

function LoadSelection()
{
	if ( !oImgAssistNode ) return ;	
  if ( oImgAssistNode.getAttribute('nid') ) {
    var NodeContent = FCKTools.ImageAssistCode( oImgAssistNode );
    if( NodeContent ) GetE('xTemplateRaw').value = NodeContent;
  }
}

//#### The OK button was hit.
function Ok()
{
	oEditor.FCKUndo.SaveUndoStep() ;
  var templateData = FCKTools.HTMLEncode( GetE('xTemplateRaw').value ).Trim().replace( /"/g, '&quot;' ) ;
	if ( !( /^\[img_assist[^\[\]]+\]$/.test( templateData ) ) )
	{
		alert( 'Image tag must start with [img_assist and end with ]. Please check it.' ) ;
		return false ;
	}
	
	//if ( !oImgAssistNode )
    var oImgAssistNode1 = FCKTools.ImageAssistDecode( templateData );
    oImgAssistNode.parentNode.insertBefore(oImgAssistNode1, oImgAssistNode);
    oImgAssistNode.parentNode.removeChild(oImgAssistNode);
    oEditor.FCKSelection.SelectNode( oImgAssistNode1 ) ;
//alert(a)
   // oImgAssistNode.appendNode(oImgAssistNode1);
/*
	FCKDragTableHandler
  
	if ( !oFakeImage )
	{
		oFakeImage	= oEditor.FCKDocumentProcessor_CreateFakeImage( 'FCK__ImgAssist', oImgAssistNode ) ;
        oFakeImage.setAttribute( "_fckimgassist", "true" ) ;
        oFakeImage.style.background="url(" + FCKConfig.PluginsPath + "imgassist/imgassist.gif);";
        oFakeImage.style.width=72;
        oFakeImage.style.height=50;
		oFakeImage	= FCK.InsertElement( oFakeImage ) ;
	}
*/
	return true ;
}

	</script>
</head>
<body style="overflow: hidden">
	<div id="divInfo">
		<table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
			<tr>
				<td>
					<span>Image Assist raw definition (from <code>[img_assist</code> to <code>]</code>)</span><br />
				</td>
			</tr>
			<tr>
				<td height="100%">
					<textarea id="xTemplateRaw" style="width: 100%; height: 100%; font-family: Monospace"
						cols="50" rows="10"></textarea>
				</td>
			</tr>
		</table>
	</div>
</body>
</html>
